<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<link rel="stylesheet" href="${webcontext}/res/style/S.css" />
	<script type="text/javascript" src="${webcontext}/res/js/jquery.min.js"></script>
	<script type="text/javascript" src="${webcontext}/res/js/S.js"></script>
	<script type="text/javascript">
		$(function(){
			var tbl  =new S.Table({
				el:'#tbl01',
				pager:true,
				pageSize:20,
				renders:{
					'content':function(c){
						return S.summary(c,100);
					},
					'ip':function(ip,data){
						if(ip){return '['+ip+']' +data.addr; }
						return '';
					}
				},
				dbclick:function(data){
					openComment(data);
				},
				menus:{
					'打开文章':function(tr){
						var data = tbl.data[$(tr).index()];
						if(data == null){return;}
						window.open('${webcontext}/blog/post/'+data.article);
					},
					'打开评论':function(tr){
						var data = tbl.data[$(tr).index()];
						if(data == null){return;}
						openComment(data);
					}
				}
			});
			
			var template = new S.Template('<div class="content"><p><b>@{title}</b><p><p>@{author} @{createTime} [@{ip}](@{addr})</p><hr/>@{content}</div>');
			function openComment(data){
				var dlg = new S.Dialog({
					title:'查看评论',
					width:500,
					height:500,
					modal:true,
					content:template.apply(data),
					buttons:{
						'关闭':function(){
							this.remove();
						}
					}
				});
				dlg.show();
			}
		});	
	</script>
</head>
<body>
	<div class="filled-box">
		<div class="toolbar">
			<span class="btn"><i class="icons page_edit"></i> 修改</span>
			<span class="btn"><i class="icons page_delete"></i> 删除</span>
		</div>
		<div class="content">
			<table id="tbl01" height="600" ds="${webcontext }/${pathvar.admin}/blog/comment/list">
				<tr>
					<td width="30" seq></td>
					<td width="50" checkall></td>
					<td width="100" resize="true">评论人</td>
					<td width="150" resize="true">Email</td>
					<td width="150" resize="true">IP地址</td>
					<td width="100" resize="true">评论日期</td>
					<td width="300" resize="true">文章</td>
					<td>评论</td>
				</tr>
				<tr>
					<td>@{seq}</td>
					<td><input type="checkbox" name="id" value="@{id}" /></td>
					<td>@{name}</td>
					<td>@{email}</td>
					<td>@{ip}</td>
					<td>@{createTime}</td>
					<td>@{title}</td>
					<td>@{content}</td>
				</tr>
			</table>
		</div>
	</div>
</body>
</html>